﻿using IdentityServer4.Models;
using IdentityServer4.Test;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Review.IdentityCenter
{
    public class Config
    {
        public static IEnumerable<ApiResource> GetApiResources()
        {
            return new List<ApiResource>() { new ApiResource("api", "myApi") };
        }

        public static IEnumerable<Client> GetClients()
        {
            return new List<Client>()
            {
                new Client()
                {
                     AllowedGrantTypes=GrantTypes.ClientCredentials,
                     ClientId="client",
                     ClientName="client",
                     AllowedScopes={ "api"},
                     ClientSecrets={ new Secret("p@ssw0rd".Sha256())}
                },new Client()
                {
                     AllowedGrantTypes=GrantTypes.ResourceOwnerPassword,
                     ClientId="passwordClient",
                     ClientName="passwordClient",
                     AllowedScopes={ "api"},
                     ClientSecrets={ new Secret("p@ssw0rd".Sha256())}
                }
            };
        }

        public static IEnumerable<TestUser> GetUsers()
        {
            return new List<TestUser>()
            {
                new TestUser()
                {
                     Username="admin",
                     Password="p@ssw0rd",
                     SubjectId=Guid.NewGuid().ToString("N")
                }
            };
        }
    }
}
